﻿using System.Data;
using System.Net;
using System.Net.Http.Headers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using OfficeOpenXml;
using Simple.Services;
using Simple.Services.System.QHSEDanger.Models.AnalysisInput;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 违章类别分析
/// </summary>
[Route("QHSEViolationCategoryAnalysisController/[action]")]
[ApiController]
public class QHSEViolationCategoryAnalysisController : ControllerBase
{
    private readonly ViolationCategoryAnalysisService _violationCategoryAnalysisService;

    public QHSEViolationCategoryAnalysisController(ViolationCategoryAnalysisService violationCategoryAnalysisService)
    {
        _violationCategoryAnalysisService = violationCategoryAnalysisService;
    }
    /// <summary>
    /// 违章类别分析--违章类别
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_v_lb_analysis")]
    public async Task<AppResult> ViolationCategoryAnalysis([FromBody] ViolationSpecialtyAnalysisInput input)
    {
        var res = await _violationCategoryAnalysisService.ViolationCategoryAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章类别分析--违章性质
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_v_lb_analysis")]
    public async Task<AppResult> ViolationTypeAnalysis([FromBody] ViolationSpecialtyAnalysisInput input)
    {
        var res = await _violationCategoryAnalysisService.ViolationTypeAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章类别分析--违章人员工龄
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_v_lb_analysis")]
    public async Task<AppResult> ViolationWorkYearsAnalysis([FromBody] ViolationSpecialtyAnalysisInput input)
    {
        var res = await _violationCategoryAnalysisService.ViolationWorkYearsAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章类别分析--违章人员年龄
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_v_lb_analysis")]
    public async Task<AppResult> ViolationAgeAnalysis([FromBody] ViolationSpecialtyAnalysisInput input)
    {
        var res = await _violationCategoryAnalysisService.ViolationAgeAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章类别分析--违章人员用工性质
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_v_lb_analysis")]

    public async Task<AppResult> ViolationEmployeeTypeAnalysis([FromBody] ViolationSpecialtyAnalysisInput input)
    {
        var res = await _violationCategoryAnalysisService.ViolationEmployeeTypeAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
}

